package realQuestion.jingDong8_19;

import java.util.Scanner;

public class Test1 {



}

class Main {





      static  String  judge(char[][] qipan){
        char winner=' ';
        if (qipan[0][1]=='*'&&qipan[0][0]=='o'&&qipan[0][2]=='o'){
            winner='o';
        }
        if (qipan[1][0]=='*'&&qipan[0][0]=='o'&&qipan[2][0]=='o'){
            winner='o';
        }
        if (qipan[2][1]=='*'&&qipan[2][0]=='o'&&qipan[2][2]=='o'){
            winner='o';
        }
        if (qipan[1][2]=='*'&&qipan[0][2]=='o'&&qipan[2][2]=='o'){
            winner='o';
        }
        if (qipan[1][1]=='*'&&qipan[0][1]=='o'&&qipan[2][1]=='o'||
                qipan[1][1]=='*'&&qipan[1][0]=='o'&&qipan[1][2]=='o'){
            winner='o';
        }


        if (qipan[0][1]=='o'&&qipan[0][0]=='*'&&qipan[0][2]=='*'){
            winner='*';
        }
        if (qipan[1][0]=='o'&&qipan[0][0]=='*'&&qipan[2][0]=='*'){
            winner='*';
        }
        if (qipan[2][1]=='o'&&qipan[2][0]=='*'&&qipan[2][2]=='*'){
            winner='*';
        }
        if (qipan[1][2]=='o'&&qipan[0][2]=='*'&&qipan[2][2]=='*'){
            winner='*';
        }
        if (qipan[1][1]=='o'&&qipan[0][1]=='*'&&qipan[2][1]=='*'||
                qipan[1][1]=='o'&&qipan[1][0]=='*'&&qipan[1][2]=='*'){
            winner='*';
        }


       if (winner=='o'){
           return "yukari";
       }
        if (winner==('*')){
            return "kou";
        }

        return  "draw";


    }



    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        char[][] one = new char[3][3];
        for (int i = 0; i < n; i++) {
            String line1 = in.next();
            char[] chars = line1.toCharArray();
            one[0]=chars;
            String line2 = in.next();
            char[] chars1 = line2.toCharArray();
            one[1]=chars1;
            String line3 = in.next();
            char[] chars2 = line3.toCharArray();
            one[2]=chars2;
            System.out.println(judge(one));
        }


    }
}